int loop_count = 0;

int tarai(int x, int y, int z)
{
    ++loop_count;

    return (y < x
            ? tarai(tarai(x-1, y, z), tarai(y-1, z, x), tarai(z-1, x, y))
            : y);

    /*
	if (y < x)
		return tarai(tarai(x-1, y, z), tarai(y-1, z, x), tarai(z-1, x, y));
	return y;
    */
}

int main()
{
	write("%d\n", tarai(12, 6, 0));
	write("%d\n", loop_count);
	return 0;
}
